]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
boxpointer: Make drawing arrow background optional
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 12 Feb 2022 15:58:06 +0000 (16:58 +0100)
committerSam Hewitt <sam@snwh.org>
Mon, 14 Feb 2022 15:22:58 +0000 (11:52 -0330)
We currently use get_color(), which assumes the color exists in the
stylesheet (and prints a warning if it doesn't).

Switch to lookup_color() and skip filling the background if no
such colors exits.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2172>

js/ui/boxpointer.js

index 1db8e56afb4e31c1c18467764845b5c054ed029b..b3b98f83a0d7c09bb1107a219ef5acabe3b37edb 100644 (file)
@@ -278,8 +278,6 @@ var BoxPointer = GObject.registerClass({
         let halfBorder = borderWidth / 2;
         let halfBase = Math.floor(base / 2);
 
-        let backgroundColor = themeNode.get_color('-arrow-background-color');
-
         let [width, height] = area.get_surface_size();
         let [boxWidth, boxHeight] = [width, height];
         if (this._arrowSide == St.Side.TOP || this._arrowSide == St.Side.BOTTOM)
@@ -422,8 +420,12 @@ var BoxPointer = GObject.registerClass({
                    Math.PI, 3 * Math.PI / 2);
         }
 
-        Clutter.cairo_set_source_color(cr, backgroundColor);
-        cr.fillPreserve();
+        const [hasColor, bgColor] =
+            themeNode.lookup_color('-arrow-background-color', false);
+        if (hasColor) {
+            Clutter.cairo_set_source_color(cr, bgColor);
+            cr.fillPreserve();
+        }
 
         if (borderWidth > 0) {
             let borderColor = themeNode.get_color('-arrow-border-color');